<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>形参和实参</title>
  </head>
  <body>
    <script>
      function and(a, b = 6) {
        return a + b;
      }
      var c = 9;
      var sum = and(1, 3); //4
      console.log(sum);
      var sum1 = and(1); //7
      console.log(sum1);
      var sum2 = and(1, true); //2
      console.log(sum2);
      var sum3 = and(1, "baidu.com"); //1baidu.com
      console.log(sum3);
      var sum4 = and(1, undefined); //7
      console.log(sum4);
      var sum5 = and(1, c); //10
      console.log(sum5);
    </script>
  </body>
</html>
